<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>北京联合大学</title>
</head>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_xufba1hg66.css">
<link rel="stylesheet" href="../../css/Initialization.css">
<link rel="stylesheet" href="../../css/commen.css">
<link rel="stylesheet" href="../../css/teaminfo.css">
<link rel="stylesheet" href="../../css/unit.css">
<body>
<div id="content">
    <div class="initer">
            <!-- 具体内容 -->
            <div class="bread">
                <div class="plain">
                    我的信息
                </div>
                <div class="plain">
                    <i class="iconfont icon-right"></i>
                </div>
                <div class="plain current">
                    小组信息
                </div>
            </div>
            <!-- 小组成员 -->
            <div class="teamdesc">
                <div class="teamtitle green fw" th:text="${groupinfo.groupname}">打造一个世界500强</div>
                <div class="desc" th:text="${groupinfo.groupintro}">小组说明小组说明小组说明小组说明小组说明小组说明小组说明</div>
            </div>
            <div class="teamyuan_title green">
                <span class="fw">小组成员</span>
                <span class="fw">创建人：<span th:text="${groupinfo.foundername}">李国庆</span></span>
            </div>
            <div class="teams">
                <div class="member" th:each="item : ${personList}">
                    <div class="img">
                        <img th:src="${item.getImgface()}" alt="">
                    </div>
                    <div class="info">
                        <div class="name fw green">
                            <i class="iconfont green fw icon-wo"></i>
                            <span th:text="${item.realname}" id="nameText">李国庆</span>
                        </div>
                        <div class="currentclass green fw" th:text="${item.departname}">商务培训4班</div>
                        <div class="infomation infomationh50" th:text="${item.profile}">成员你生情成员你生情成员你生生情成员你生情成员你生情成员你生</div>
                        <div class="center-button" th:if="${item.id != groupinfo.founderid && userid == groupinfo.founderid && groupinfo.state == 0}" th:onclick="'javascript:exitGroup(\''+${item.id}+'\',this)'">移出小组</div>
                    </div>
                </div>
            </div>
            <div class="button" th:if="${groupinfo.state == 0 && userid == groupinfo.founderid}" th:onclick="'javascript:updateState(\''+${groupinfo.id}+'\')'"><span class="center-button">提交小组申请</span></div>
            <!-- 确认删除 -->
            <div class="mask none">
                <div class="sureteam">
                    <div class="title" id="messagetitle">
                        确认移出小组
                    </div>
                    <div class="teamcenter">
                        <div class="teamdesc_tip" id="resultmessage">
                            你是否确定将“XXX”移出本小组？
                        </div>
                        <div class="surebtns">
                            <input type="hidden" id="exitid" name="exitid"/>
                            <div class="center-button" id="yesexit">确认移出</div>
                            <div class="center-button" id="noexit">暂不移出</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/commen.js"></script>
<script>
function exitGroup(id,obj) {
    var name = $(obj).parent().find("#nameText").html();
    $("#resultmessage").html("你是否确定将“"+name+"”移出本小组？");
    $("#messagetitle").html("确认移出小组");
    $("#yesexit").html("确认移出");
    $("#noexit").html("暂不移出");
    $("#exitid").val(id);
    $('.mask').removeClass('none');
    $("#yesexit").click(function () {
        var exitid = $("#exitid").val();
        $.ajax({
            type : "POST",
            url : "../StudentGroup/exitGroup",
            data : {userid: exitid},
            dataType : "json",
            success : function(json) {
                alert(json.result)
                if(json.state == success){
                    location.reload();
                }
            },
            error:function(msg){
                alert("程序出错，请联系管理员");
            }
        });
    });
}

function updateState(id) {
    $("#resultmessage").html("是否确定提交小组申请");
    $("#messagetitle").html("确认提交小组申请");
    $("#yesexit").html("确认申请");
    $("#noexit").html("暂不申请");
    $("#exitid").val(id);
    $('.mask').removeClass('none');
    $("#yesexit").click(function () {
        var exitid = $("#exitid").val();
        $.ajax({
            type : "POST",
            url : "../StudentGroup/updateState",
            data : {groupid: exitid,state: 1},
            dataType : "json",
            success : function(json) {
                alert(json.result)
                if(json.state == success){
                    location.reload();
                }
            },
            error:function(msg){
                alert("程序出错，请联系管理员");
            }
        });
    });
}

function change(message){
    $("#resultmessage").html(message);
    $("#yesexit").hide();
    $("#noexit").html("确定");
    $("#noexit").click(function () {
        location.reload();
    });
}

$(function () {
    $("#noexit").click(function () {
        $('.mask').addClass('none');
    });

})
</script>
</body>
</html>

